export default (permission_data = []) => {
  return {
    name: "tb-permission",
    props: {
      code: {
        type: String,
        default: ""
      }
    },
    data() {
      return {
        routeList: permission_data
      };
    },
    methods: {
      //TODO judge permission
      judgePermission() {
        let result = false;
		const index = this.routeList.findIndex(item=>this.code === item.frontUrl)
		if(index === -1){
			return false
		}
		return true
      }
    },
    render() {
      if (this.judgePermission()) {
        return this.$slots.default;
      }
      return "";
    }
  };
};
